"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Promise = require("promise");
var DdMapi = /** @class */ (function () {
    function DdMapi() {
    }
    DdMapi.prototype.config = function (cfg) {
        dd.config(cfg);
    };
    DdMapi.prototype.ready = function () {
        return new Promise(function (resolve) {
            dd.ready(function () {
                resolve();
            });
        });
    };
    DdMapi.prototype.error = function () {
        return new Promise(function (resolve) {
            dd.error(function (error) {
                resolve(error);
            });
        });
    };
    DdMapi.prototype.requestAuthCode = function (corpId) {
        return new Promise(function (resolve, reject) {
            console.log('requestAuthCode mobile');
            dd.runtime.permission.requestAuthCode({
                corpId: corpId,
                onSuccess: function (result) {
                    console.log('requestAuthCode', result.code);
                    resolve(result.code);
                },
                onFail: function (err) {
                    reject(err);
                }
            });
        });
    };
    return DdMapi;
}());
exports.DdMapi = DdMapi;
var ddMapi = new DdMapi();
exports.default = ddMapi;
